<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('修改')"/>
</head>
<body>
<form action="" class="layui-form" th:object="${Zg}">
    <div class="mainBox">
        <div class="main-container">
            <div class="main-container">

                <div class="layui-form-item layui-hide">
                    <label class="layui-form-label">人员编号</label>
                    <div class="layui-input-block">
                        <input autocomplete="off" class="layui-input" lay-verify="title" name="bh"
                               th:value="*{bh}" type="text">
                    </div>
                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label">工号</label>
                    <div class="layui-input-block">
                        <input autocomplete="off" class="layui-input" name="gh" placeholder="工号" th:value="*{gh}"
                               type="text">
                    </div>
                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label">姓名</label>
                    <div class="layui-input-block">
                        <input autocomplete="off" class="layui-input" name="xm" placeholder="姓名" th:value="*{xm}"
                               type="text">
                    </div>
                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label">性别</label>
                    <div class="layui-input-block">
<!--                        <input autocomplete="off" class="layui-input" name="xb" placeholder="性别" th:value="*{xb}"-->
<!--                               type="text">-->
                        <select id="xb" name="xb" th:field="*{xb}">-->
                            <option value="男">男</option>
                            <option value="女">女</option>

                        </select>
                    </div>
                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label">民族</label>
                    <div class="layui-input-block">
                        <input autocomplete="off" class="layui-input" name="mz" placeholder="民族" th:value="*{mz}"
                               type="text">
                    </div>
                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label">身份证号码</label>
                    <div class="layui-input-block">
                        <input autocomplete="off" class="layui-input" name="sfzhm" placeholder="身份证号码"
                               th:value="*{sfzhm}" type="text">
                    </div>
                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label">部门</label>
                    <div class="layui-input-block">
                        <input autocomplete="off" class="layui-input" name="bm" placeholder="部门" th:value="*{bm}"
                               type="text">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">职务</label>
                    <div class="layui-input-block">
                        <input autocomplete="off" class="layui-input" name="zw" placeholder="职务" th:value="*{zw}"
                               type="text">
                    </div>
                </div>

                <!--						<div class="layui-form-item">-->
                <!--		                    <label class="layui-form-label">下级部门</label>-->
                <!--		                    <div class="layui-input-block">-->
                <!--		                        <input th:value="*{xjbm}" type="text" name="xjbm" autocomplete="off" placeholder="下级部门" class="layui-input">-->
                <!--		                    </div>-->
                <!--		                </div>-->
                <!--					                -->


                <!--						<div class="layui-form-item">-->
                <!--		                    <label class="layui-form-label">政治面貌</label>-->
                <!--		                    <div class="layui-input-block">-->
                <!--&lt;!&ndash;		                        <input th:value="*{zzmm}" type="text" name="zzmm" autocomplete="off" placeholder="政治面貌" class="layui-input">&ndash;&gt;-->
                <!--								<select name="zzmm" id="zzmm" th:field="*{zzmm}">-->
                <!--									<option value="1">群众</option>-->
                <!--									<option value="2">中共党员</option>-->
                <!--									<option value="3">中共预备党员</option>-->
                <!--									<option value="4">共青团员</option>-->
                <!--									<option value="5">其他</option>-->
                <!--								</select>-->
                <!--		                    </div>-->
                <!--		                </div>-->


            </div>
        </div>
    </div>
    <div class="bottom">
        <div class="button-container">
            <button class="layui-btn layui-btn-normal layui-btn-sm" lay-filter="zg-update" lay-submit=""
                    type="submit">
                <i class="layui-icon layui-icon-ok"></i>
                提交
            </button>
            <button class="layui-btn layui-btn-primary layui-btn-sm" type="reset">
                <i class="layui-icon layui-icon-refresh"></i>
                重置
            </button>
        </div>
    </div>
</form>
<th:block th:include="include :: footer"/>
<script>
    layui.use(['form', 'laydate', 'jquery'], function () {
        let form = layui.form;
        let $ = layui.jquery;
        let MODULE_PATH = rootPath + "/ZgController";
        var laydate = layui.laydate;
        //同时绑定多个
        lay('.datetime-input').each(function () {
            laydate.render({
                elem: this
                , trigger: 'click'
                , type: 'datetime'
            });
        });


        form.on('submit(zg-update)', function (data) {
            let loader = layer.load();
            $.ajax({
                url: MODULE_PATH + '/edit',
                data: data.field,
                dataType: 'json',
                contentType: 'application/x-www-form-urlencoded',
                type: 'post',
                success: function (result) {
                    if (result.code == 200) {
                        layer.msg(result.msg, {icon: 1, time: 1000}, function () {
                            parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
                            parent.layui.table.reload("zg-table");
                            layer.close(loader);
                        });
                    } else {
                        layer.msg(result.msg, {icon: 2, time: 1000});
                        layer.close(loader);
                    }
                }
            })
            return false;
        });
    })
</script>
</body>
</html>